window.addEvent("domready", function () {

	var settings = new FancySettings("Die2Nite Agent", chrome.extension.getURL("img/icon-48.png"));

	settings.create({
		"tab": "Options",
		"group": "External Map",
		"type": "description",
		"text": "Update map with the following external Die2Nite applications:"
	});

	var bgPage = chrome.extension.getBackgroundPage();

	for (var applicationID in bgPage.mapApplications) {

		settings.create({
			"tab": "Options",
			"group": "External Map",
			"name": "update-" + applicationID,
			"type": "checkbox",
			"label": '<img src="' + chrome.extension.getURL("img/icon-" + applicationID + ".png") + '" />' + bgPage.mapApplications[applicationID].name
		});
	}

	// Update wait time
	settings.create({
		"tab": "Options",
		"group": "External Map",
		"name": "waitTime",
		"type": "slider",
		"label": "Wait for",
		"max": 10,
		"min": 2,
		"step": 1,
		"display": true,
		"displayModifier": function (value) {
			return value + " seconds";
		}
	});

	settings.create({
		"tab": "Options",
		"group": "External Map",
		"type": "description",
		"text": "Extension will wait for the specified number of seconds before sending external map update. This waiting time is used to combine actions into a single update request - you can pick up multiple items while the status is <em>waiting</em> and only a single map update will be sent."
	});

	// Compact Mode
	settings.create({
		"tab": "Options",
		"group": "Extras",
		"name": "compactMode",
		"type": "checkbox",
		"label": "Enable Compact Mode"
	});

	settings.create({
		"tab": "Options",
		"group": "Extras",
		"type": "description",
		"text": "In a compact mode, certain redundant/graphical Die2Nite UI elements will be removed to help you focus on content. This option will also fix horizontal scrollbar issues on small resolution displays."
	});

	// Expert Mode
	settings.create({
		"tab": "Options",
		"group": "Extras",
		"name": "expertMode",
		"type": "checkbox",
		"label": "Enable Expert Mode"
	});

	settings.create({
		"tab": "Options",
		"group": "Extras",
		"type": "description",
		"text": "This mode will hide blue help boxes that are used to guide new Die2Nite players. In addition to this, certain decoration texts and a couple of graphical images will be removed as well."
	});
});